var express = require('express')
    , log4js = require('log4js')
    , bodyParser = require('body-parser')
    , serveStatic = require('serve-static')
    , mongoose = require('mongoose');

var port = 3000;
var logger = log4js.getLogger();

var app = module.exports = express();

app.use(log4js.connectLogger(logger));
app.use(serveStatic(__dirname + '/public'));
app.use(bodyParser.urlencoded({ extended: true }));

app.all('/*', (req, res, next) => {
    console.log('url: ', req.url);
    next();
});

app.get('/', (req, res) => {
    res.send('index!');
});

var route = require('./route');
route(app);

app.listen(port, () => {
    console.log('server start! listening on %s...', port);
});